package xyz.xtt.pay.service;

import java.util.List;
import java.util.Map;
import java.util.Set;

import com.baomidou.mybatisplus.extension.service.IService;

import xyz.xtt.pay.api.enums.GoodsTypeEnum;
import xyz.xtt.pay.client.request.BusinessOrderRequest;
import xyz.xtt.pay.client.response.BusinessOrderDto;
import xyz.xtt.pay.client.response.BusinessOrderResponse;
import xyz.xtt.pay.entity.TblBusinessOrder;

/**
 * <p>
 * 订单表 服务类
 * </p>
 *
 * @author dale
 * @since 2025-02-25
 */
public interface ITblBusinessOrderService extends IService<TblBusinessOrder> {

	List<TblBusinessOrder> selectListByGoodsIds(BusinessOrderRequest businessOrderRequest);

	TblBusinessOrder queryNotPayOrder(long appUserId, GoodsTypeEnum goodsTypeEnum, long assetCardId);

	boolean updatePaySuccess(TblBusinessOrder tblBusinessOrder);

	boolean updatePayCancel(TblBusinessOrder businessOrder, String reason);

	/**
	 * 根据ID批量获取数据
	 * 
	 * @param ids
	 * @return
	 */
	Map<Long, TblBusinessOrder> getBusinessByIds(Set<Long> ids);

	/**
	 * 根据ID查询数据
	 * 
	 * @param businessOrderId
	 * @return
	 */
	BusinessOrderDto getBusinessOrderDtoById(Long businessOrderId);

	/**
	 * 根据ID获取数据
	 * 
	 * @param businessOrderId
	 * @return
	 */
	TblBusinessOrder getByIdForUpdate(Long businessOrderId);

	/**
	 * 更新订单支付成功
	 * 
	 * @param orderId
	 */
	boolean updateOrderPaySuccess(TblBusinessOrder orderId);

	/**
	 * 更新订单取消
	 * 
	 * @param businessOrder
	 * @return
	 */
	boolean updateOrderCancel(TblBusinessOrder businessOrder);

	/**
	 * 查询待支付订单
	 * 
	 * @param buyerId
	 * @param code
	 * @param goodsId
	 * @return
	 */
	TblBusinessOrder getUnPayBusinessOrder(long buyerId, int code, String goodsId);

	BusinessOrderResponse businessOrderInfoWithId(Long businessOrderId);

}
